package com.autosalon.DAO;

import org.hibernate.Session;

import com.autosalon.DaoCore.HibernateUtil;

class MainDAO {
	
	public MainDAO(){
	}
	
	public void insert(Object object){
		getSession().save(object);
	}
	
	public void delete(Object object){
		getSession().delete(object);
	}
	
	public void update(Object object){
		getSession().merge(object);
	}

	public Session getSession() {
		Session currentSession = HibernateUtil.getSessionFactory()
				.getCurrentSession();
		if (!currentSession.getTransaction().isActive()) {
			currentSession.beginTransaction();
		}
		return currentSession;
	}
	
	
	
}
